package com.dxy.app.act_widget;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.TextView;
import com.dxy.app.R;
import com.dxy.app.act_widget.adapter.MyPagerAdapter;
import com.dxy.app.widget.shading_view.ShadingView;
import java.util.ArrayList;
import java.util.List;

/**
  *Created by duxingyu on 2017/7/26.17:04
  *Email: 
  *Description:仿微信底部buttom
  **/

public class WeichatActivity extends Activity{

  private ViewPager pager;
  private ShadingView indicator;

  @Override protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_weichat);

    initViews();
  }

  private void initViews(){
    pager = (ViewPager) findViewById(R.id.vp_weichat);
    indicator = (ShadingView) findViewById(R.id.sv_weichat);

    List<View> viewList =new ArrayList<>();
    for(int i=0;i<4;i++){
      TextView tv =new TextView(this);
      tv.setTextColor(Color.BLACK);
      tv.setText("页码:"+i);
      viewList.add(tv);
    }
    adapter =new MyPagerAdapter(this,viewList);
    pager.setAdapter(adapter);

    String []tags =new String[]{"微信","通信录","发现","我"};

    int [] resIdDef =new int[]{R.mipmap.chats,R.mipmap.contacts,R.mipmap.discover,R.mipmap.about_me};
    int [] resIdSel =new int[]{R.mipmap.chats_green,R.mipmap.contacts_green,R.mipmap.discover_green,R.mipmap.about_me_green};
    indicator.setDataResource(tags,resIdDef,resIdSel);

    indicator.setPager(pager);
  }
  private MyPagerAdapter adapter;
}
